SPHERE_FALL_DIST

Overview

Calculate distance traveled by a falling sphere after a given time.

Excel Usage

=SPHERE_FALL_DIST(D, rhop, rho, mu, t, V)
  • D (float, required): Diameter of the sphere [m]
  • rhop (float, required): Particle density [kg/m^3]
  • rho (float, required): Density of the surrounding fluid [kg/m^3]
  • mu (float, required): Viscosity of the surrounding fluid [Pa*s]
  • t (float, required): Time to integrate to [s]
  • V (float, optional, default: 0): Initial velocity of the particle [m/s]

Returns (float): Distance traveled by falling sphere in time t [m], or error message (str) if invalid.

Examples

Example 1: Particle falling in air from rest

Inputs:

D rhop rho mu t V
0.001 2200 1.2 0.0000178 0.5 0

Excel formula:

=SPHERE_FALL_DIST(0.001, 2200, 1.2, 0.0000178, 0.5, 0)

Expected output:

Result
1.0801

Example 2: Particle with high initial velocity

Inputs:

D rhop rho mu t V
0.001 2200 1.2 0.0000178 0.5 30

Excel formula:

=SPHERE_FALL_DIST(0.001, 2200, 1.2, 0.0000178, 0.5, 30)

Expected output:

Result
7.8295

Example 3: Short integration time

Inputs:

D rhop rho mu t V
0.001 2200 1.2 0.0000178 0.1 0

Excel formula:

=SPHERE_FALL_DIST(0.001, 2200, 1.2, 0.0000178, 0.1, 0)

Expected output:

Result
0.0484

Example 4: Particle in water

Inputs:

D rhop rho mu t V
0.0001 2600 1000 0.001 0.5 0

Excel formula:

=SPHERE_FALL_DIST(0.0001, 2600, 1000, 0.001, 0.5, 0)

Expected output:

Result
0.004

Python Code

import micropip
await micropip.install(["fluids"])
from fluids.drag import integrate_drag_sphere as fluids_integrate_drag_sphere

def sphere_fall_dist(D, rhop, rho, mu, t, V=0):
    """
    Calculate distance traveled by a falling sphere after a given time.

    See: https://fluids.readthedocs.io/fluids.drag.html#fluids.drag.integrate_drag_sphere

    This example function is provided as-is without any representation of accuracy.

    Args:
        D (float): Diameter of the sphere [m]
        rhop (float): Particle density [kg/m^3]
        rho (float): Density of the surrounding fluid [kg/m^3]
        mu (float): Viscosity of the surrounding fluid [Pa*s]
        t (float): Time to integrate to [s]
        V (float, optional): Initial velocity of the particle [m/s] Default is 0.

    Returns:
        float: Distance traveled by falling sphere in time t [m], or error message (str) if invalid.
    """
    # Validate inputs
    try:
        D = float(D)
        rhop = float(rhop)
        rho = float(rho)
        mu = float(mu)
        t = float(t)
        V = float(V)
    except (ValueError, TypeError):
        return "Error: All parameters must be numbers."

    if D <= 0:
        return "Error: Diameter must be positive."
    if rhop <= 0:
        return "Error: Particle density must be positive."
    if rho <= 0:
        return "Error: Fluid density must be positive."
    if mu <= 0:
        return "Error: Viscosity must be positive."
    if t < 0:
        return "Error: Time must be non-negative."

    try:
        result = fluids_integrate_drag_sphere(D=D, rhop=rhop, rho=rho, mu=mu, t=t, V=V, distance=True)
        # Returns tuple (velocity, distance) when distance=True
        distance_result = result[1]
        if distance_result != distance_result:  # NaN check
            return "Calculation resulted in NaN."
        return float(distance_result)
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator